﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/*********************************************************
 * 命名空间 Simple.Framework.Load
 * 接口名称 LoadClassCloadProcess
 * 开发人员：ADMIN
 * 创建时间：2023/12/25 10:16:18
 * 描述说明：
 * 更改历史：
 * 
 * *******************************************************/
namespace Simple.Framework.Load
{
	public class LoadClassLoadProcess:BaseLoadProcess,IClassLoadProcess
	{

		private Type itype;

		private Type baseType;

		private IClassLoader classLoader;
		public LoadClassLoadProcess(IClassLoader classLoader)
		{
			itype=typeof(IClassLoadProcess);
			baseType=typeof(BaseLoadProcess);
			this.classLoader = classLoader;
		}

		public override bool Process(Type type)
		{

			if (type.IsAssignableTo(itype) && !type.IsInterface && type.FullName!= baseType.FullName && type.FullName!=typeof(LoadClassLoadProcess).FullName)
			{
				container.Register(type).Autowird();
				var load = container.GetService(type);
				this.classLoader.Register((IClassLoadProcess)load);
			}
			return base.Process(type);
		}
	}
}
